import request from '@/utils/request'
import '@/utils/index'

export function login(username, password) {
  return request({
    url: '/user/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'post',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function teacherRegister(username, password, mobile) {
  return request({
    url: '/teacher/register',
    method: 'post',
    data: {
      username,
      password,
      mobile
    }
  })
}
export function xwTeacherRegister(username, name, birthday, gender, mobilePhone, email, password) {
  return request({
    url: '/xwTeacher/register',
    method: 'post',
    data: {
      username,
      name,
      birthday,
      gender,
      mobilePhone,
      email,
      password
    }
  })
}

export function examineeRegister(username, password) {
  return request({
    url: '/student/register',
    method: 'post',
    data: {
      username,
      password
    }
  })
}
export function changePassword(username, oldPassword, newPassword) {
  return request({
    url: '/user/changePassword',
    method: 'post',
    data: {
      username,
      oldPassword,
      newPassword
    }
  })
}
export function findPassword(username, mobile, newPassword) {
  return request({
    url: '/user/findPassword',
    method: 'post',
    data: {
      username,
      mobile,
      newPassword
    }
  })
}
